#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define F first
#define S second
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;

void solve()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	int a=0,b=0;
	for(auto it:s)
	{
		if(it=='A') a++;
		else b++;
	}
	cout<<s[n-1]<<'\n';
}
int main()
{
	IOS;
	int T=1;
	cin>>T;

	while(T--)
	{
		solve();
	}

	return 0;
}

